package top.auntie.bean;

import top.auntie.common.Constants;

public class Result {

    private String code;
    private String msg;
    private Object data;

    public Result(String code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static Result success() {
        return getInstance(Constants.SUCCEED, null, null);
    }

    public static Result success(Object data) {
        return getInstance(Constants.SUCCEED, null, data);
    }

    public static Result success(String msg, Object data) {
        return getInstance(Constants.SUCCEED, msg, data);
    }

    public static Result getInstance(String code, String msg, Object data) {
        return new Result(code, msg, data);
    }

    public static Result failed() {
        return getInstance(Constants.FAILED, null, null);
    }

    public static Result failed(Object data) {
        return getInstance(Constants.FAILED, null, data);
    }

    public static Result failed(String msg, Object data) {
        return getInstance(Constants.FAILED, msg, data);
    }

    public static Result failed(String msg) {
        return getInstance(Constants.FAILED, msg, null);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
